#include <iostream>
#include <string>
#include "DB.h"

using namespace std;

int main()
{

	//Sample use of the Database

	DB db;
	db.createTable();
	char *url = new char[80];
	url = "Facebook";	
	char *comment = new char[1000];
	comment = "This is sooo cool. I love this! hehe";
	int counterUp = 5;
	int counterDown = 4;

	//Code to test inserting of URL - works
	db.insertURL(url, counterUp, counterDown);
	//vector<vector<string> > result1 = db.getURLs(url);
	//db.printValues(result1);

	//Code to test inserting comments for a specific URL
	db.addComment(url, comment);
	db.addComment(url, "Happy to you");
	//db.addComment("Facebook", "Happy to you");
	//db.addComment(url, "This shouldn't be printed");
	vector<vector<string> > result = db.getComments(url);
	db.printValues(result);
	
	int cUP = db.getCounterUp(url);
	int cDown = db.getCounterDown(url);
	cout <<endl <<"Counter UP = " <<cUP <<" Counter Down =" <<cDown<<endl;
	db.incCounter(url);
	cUP = db.getCounterUp(url);
	cout <<"Updated Counter UP =" <<cUP<<endl;
	db.decCounter(url);
	cDown = db.getCounterDown(url);
	cout <<"Updated Counter DOWN =" <<cDown<<endl;
	db.closeDB();

	return 0;
}	
